package main

import (
	"macapp/models"
	_ "macapp/routers"
	"github.com/astaxie/beego"
	"github.com/astaxie/beego/orm"
	_ "github.com/go-sql-driver/mysql"
)

func init() {
	mysql_username := beego.AppConfig.String("username")
	mysql_userpasswd := beego.AppConfig.String("userpasswd")

	connectionString := mysql_username + ":" + mysql_userpasswd + "@tcp(106.14.27.36:17336)/macapp?charset=utf8"

	orm.RegisterDriver("mysql", orm.DRMySQL)

	orm.RegisterDataBase("default", "mysql", connectionString)

	orm.RegisterModel(new(models.Camille),new(models.Vipusers),new(models.Classification),new(models.Soft))
	orm.RunSyncdb("default", false, true)
}

func main() {
	models.O=orm.NewOrm()
	models.O.Using("default")

	beego.Run()
}
